import QtQuick
import Fk
import Fk.Pages.LunarLTK

GraphicsBox {
  id: root

  width: 303
  height: 87

  property string result: ""
  property string pieceColor: "white"

  Rectangle{
    id: choiceBox
    radius: 5
    anchors.fill: parent
    color: '#a6ddddba'

    Row {
      id: body
      x: 10
      y: 10
      spacing: 5

      Repeater {
        model: ["rook", "knight", "bishop", "queen"]

        Rectangle {
          width: 67
          height: 67
          color: "transparent"

          Image {
            id: img
            source: `${Cpp.path}/packages/chess-games/image/nchess/${pieceColor}_${modelData}.svg`
            sourceSize: Qt.size(200, 200)
            width: 72
            height: 72
            anchors.centerIn: parent
          }

          MouseArea {
            id: mouseArea
            anchors.fill: parent

            property bool contains: containsMouse

            onClicked: {
            result = modelData;
            root.close();
            }
          }
        }
      }
    }
  }
}
